home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ShareWare OnLine 2
/
ShareWare OnLine Volume 2 (CMS Software)(1993).iso
/
printing
/
ds2v4052.zip
/
FORPGMRS.EXE
/
lha
/
README.DOC
< prev
next >
Wrap
Text File
|
1993-03-08
|
17KB
|
421 lines
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▌ ▐
▌ The Despooling Library by Budget Software Company ▐
▌ v 1.02 P.O. Box 621534 ▐
▌ Littleton CO 80162 ▐
▌ (303) 932-1705 ▐
▌ ▐
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
=========================================================================
Introduction
------------
The Despooling Library features three levels of functionality:
- You can use DSP.OBJ by itself, in which case you've got a mechanism for
sending output to your LPT and COM ports. You must supply all of the
interrupt handling. All DSP does is allow you to send it a byte, or
a pointer to a byte stream, and indicate the printing port.
The program TDSP.CPP is included as a demonstration of DSP.OBJ's
functionality.
- In addition to using DSP.OBJ, you can also utilize the two DSPCTL modules:
DSPCTL1.OBJ and DSPCTL2.OBJ. (The reason that the DSPCTL function is
separated into two OBJ's is that you can discard DSPCTL2.OBJ after
initialization is complete, if you want.) DSPCTLx controls the despooling
activity at a higher level. First of all, it hooks several interrupts.
(You decide which ones you want to have it hook: 8, 16, b, c, and/or f.)
Secondly, you can pass as long a stream as you wish to it (up to 64k),
and it will perform the background printing using the interrupts you
told it to use. When it has finished the stream, it will inform you
by calling a routine (indirect far pointer) that you have designated.
The port associated with the stream is indicated to you, so that all
you have to do in your "calledback" routine is fetch some more data, and
issue another print request for the port.
All 8 ports can be managed asynchronously. Just send each port a request
to print, and you'll have multiple printers printing in the background,
and at the same time!
The program TDSPCTL.ASM is included as a demonstration of DSPCTLx.OBJ's
functionality.
- In addition to the above two modules, you can optionally include modules
DSPFIL.OBJ and DSPFIL2.OBJ. These two modules work exactly like the DSPCTLx
modules described above, except that they allow you to designate a disk
file to be printed, rather than simply a memory buffer. When the file
is all printed, a "callback" is made (optionally) to your designated
routine. (Note: you must also include modules BACKGRDM.OBJ and BACKGRM2.OBJ,
as well as MSGQUE.OBJ and MSGQUE2.OBJ.)
The program TDSPF.ASM is included as a demonstration of DSPDILx.OBJ's
functionality.
==============================================================================
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▌ DSP.OBJ ▐
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
Features
--------
- Supports all 4 COM and all 4 LPT ports.
- Dynamically adjustes "wait time" for printer.
- Supports simultaneous printing of all 8 ports.
- Supports both printing directly to port as well as utilizing the BIOS.
- You can indicate how many are to be printed at each INT8 for each port;
and you can indicate a maximum time slice in 10,000ths of a second, as well.
Instructions for use
--------------------
There are two functions:
_dspler_init_me - Initializes DSP. Must be called at least once
before calling function _dspler_despool. You may
call this routine again if you wish to change the
despooling method (direct vs. BIOS) for a port.
_dspler_despool - Sends byte(s) to the printer.
┌──────────────────┐
│ _dspler_init_me │
└──────────────────┘
ENTRY: AL - 8 bits, one for each port; biton means to use the BIOS
method of Despooling. bit 7 = COM1; bit 6 = COM2 ... bit 3 = LPT1,
and so forth.
AH - 8 bits, one for each port; biton means to use the direct
method of Despooling. The meaning of the bits is the same as
with AL, above.
DX - The maximum amount of time (in 10,000ths of a second units)
that should be spent in an INT8.
(Note: The reason I didn't simply use AL as a binary condition, biton =
use BIOS, and bitoff = go direct to port, is that I am planning for
a third method of despooling; namely, output using DOS. There is
a complication using this method in that you can only perform output
using DOS when it's "safe", re-entry wise. Despooling via DOS is
rarely needed, so for now, I am not including it in the code.)
┌──────────────────┐
│ _dspler_despool │
└──────────────────┘
ENTRY: CL - number of bytes to send.
(Note: If you are coming off of an IRQ, or off of Idle time (int16),
then you should always set CL to 1. This is because
there is nothing to gain trying to send multiple bytes
from these sources. The next IRQ will almost certainly
occur before the printer is ready; and as for Idle time,
you should be looping within INT 16h until a byte is
ready at the keyboard buffer; and so again, the next
call into this routine will certainly happen before
the printer is ready.)
BL - Port
0=COM1
1=COM2
2=COM3
3=COM4
4=LPT1
5=LPT2
6=LPT3
7=LPT4
BH - Source of print request
0 - IRQ
1 - Idle
2 - Timer interrupt
(Note: The reason for this parameter is so the program can
perform "retry" action if it is in the Timer interrupt.
Retry action is when the system delays a bit waiting
for the printer to finish processing a byte. It doesn't
make any sense to perform retry action from IRQ or
from Idle, since by definition, these sources of print
requests are occurring continuously, anyway.)
CH - If CL = 1, then CH contains the byte to print.
DX:AX - If CL is greater than 1, then DX:AX should point to the
stream of characters.
RETURN: AH = 0 means that the function terminated normally, in which case
AL returns the number of bytes actually printed. (Note: just because
the function terminated normally doesn't mean any bytes were actually
printed. Maybe the printer is offline.)
AH not = 0 means that an error occured. Most likely you sent
an invalid input parameter.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▌ DSPCTLx.OBJ ▐
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
Features
--------
- Utilizes DSP.OBJ to provide complete asynchonous background printing to
up to 8 ports simultaneously.
- Hooks the "background" interrupts.
- Allows you to designate which of the "background" interrupts you wish
to utilize (8, 16, b, c, and/or f).
Instructions for use
--------------------
There are two functions:
_dspctl_init_me - Initializes DSPCTLx. Must be called once, and
only once, before calling function
_dspctl_request print.
_dspctl_request_print - Issue a print request.
┌──────────────────┐
│ _dspctl_init_me │
└──────────────────┘
(NOTE: _dspctl_init_me takes care of calling _dspler_init_me for you.)
ENTRY - DX:AX points to a structure that looks like this:
offset type description
------ ---- -----------------------------------------------------
0 dd original int 8 vector; if left 0, I won't hook int8
4 dd original int 16 vector; if left 0, I won't hook int16
8 dd original int b vector; if left 0, etc.
c dd original int c vector; etc.
10h dd original int f vector; etc.
14h dd far ptr to routine you want me to call whenever
I need to tell you that I've finished a stream, and
am ready for more.
BL will contain 0 - com1 needs more
1 - com2 needs more
2 - com3 needs more
3 - com4 needs more
4 - lpt1 needs more
5 - lpt2 needs more
6 - lpt3 needs more
7 - lpt4 needs more
18h dw # bytes/timer tick...com1
1Ah dw # bytes/timer tick...com2
1Ch dw # bytes/timer tick...com3
1Eh dw # bytes/timer tick...com4
20h dw # bytes/timer tick...lpt1
22h dw # bytes/timer tick...lpt2
24h dw # bytes/timer tick...lpt3
26h dw # bytes/timer tick...lpt4
28h db com port number for intb; 1=com1, 2=com2, etc.
29h db com port number for intc; 1=com1, 2=com2, etc.
2Ah db 8 bits. bit 7=com1, bit 6=com2 ... bit 3=lpt1, etc.
Use Bios for output.
2Bh db 8 bits. bit 7=com1, bit 6=com2 ... bit 3=lpt1, etc.
Output direct.
2Ch dw Maximum amount of time (in 10,000ths of a second units)
to spend within INT8.
RETURN - none
┌────────────────────────┐
│ _dspctl_request_print │
└────────────────────────┘
INPUT: DX:AX is a pointer to a stream of data
CX is the number of bytes in the stream
BH indicates port, as follows:
bit 7->COM1
bit 6->COM2
bit 5->COM3
bit 4->COM4
bit 3->LPT1
bit 2->LPT2
bit 1->LPT3
bit 0->LPT4
Note how in this manner, you can send a stream to multiple
printers in one shot. Believe it or not, I've had a person
request this feature. It's really not that unusual,
since this is a good way to produce multiple copies. This won't
work for large documents, since depending on the speed of the
printers, one printer will surely finish the stream before the other;
and it would be wasteful to have to fast printer wait around for
the slow one to catch up.
RETURN: AL not 0 -> problem, and furthermore, the bits of AL
indicate ports that couldn't accept the request, since
such port is currently handling a prior request. The bits of AL are
defined in the same manner as BH, above.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▌ DSPFILx.OBJ ▐
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
Features
--------
- Utilizes DSP.OBJ and DSPCTL.OBJ to provide complete asynchonous background
printing to up to 8 ports simultaneously.
- Prints an entire DOS file.
- Two methods of file submittals:
- Internal far call.
- Using an INT 1A.
Instructions for use
--------------------
There are two functions:
_dspfil_init_me - Initializes DSPFILx. Must be called once, and
only once, before calling function
_dspfil_request print.
_dspfil_request_print - Issues a print request.
There is also a way to issue a print request via an INT 1Ah (see below).
┌──────────────────┐
│ _dspfil_init_me │
└──────────────────┘
(NOTE: _dspfil_init_me takes care of calling _dspctl_init_me for you.)
INPUT - DX:AX points to a structure that looks like this:
offset type description
------ ---- -----------------------------------------------------
0 dd original int 8 vector; if left 0, I won't hook int8
4 dd original int 16 vector; if left 0, I won't hook int16
8 dd original int b vector; if left 0, etc.
c dd original int c vector; etc.
10h dd original int f vector; etc.
14h dd far ptr to routine you want me to call whenever
I need to tell you something ... usually to inform
you that I've printed the file and am ready for more.
BL will contain 0 - com1 done
1 - com2 done
2 - com3 done ▒
3 - com4 done ▒
4 - lpt1 done ▒
5 - lpt2 done ▒
6 - lpt3 done ■
7 - lpt4 done ▒
DX:AX will point to file just printed ▒
18h dw # bytes/timer tick...com1 ▒
1Ah dw # bytes/timer tick...com2 ▒
1Ch dw # bytes/timer tick...com3 ▒
1Eh dw # bytes/timer tick...com4 ▒
20h dw # bytes/timer tick...lpt1 ▒
22h dw # bytes/timer tick...lpt2 ▒
24h dw # bytes/timer tick...lpt3 ▒
26h dw # bytes/timer tick...lpt4 ▒
28h db com port number for intb 1=com1, 2=com2, etc. ▒
29h db com port number for intc ▒
2Ah db 8 bits. bit 7=com1, bit 6=com2 ... bit 3=lpt1, etc. ▒
Use Bios for output.
2Bh db 8 bits. bit 7=com1, bit 6=com2 ... bit 3=lpt1, etc. ■
Output direct. ▒
2Ch dw max number of 10,000ths of a second I should spend in ▒
int8. ▒
RETURN - none ▒
┌────────────────────────┐
│ _dspfil_request_print │
└────────────────────────┘
INPUT - DX:AX points to an ASCIIZ
BH indicates port, as follows:
bit 7->COM1
bit 6->COM2
bit 5->COM3
bit 4->COM4
bit 3->LPT1
bit 2->LPT2
bit 1->LPT3
bit 0->LPT4
CL='n'->don't bother calling back when done.
RETURN: AL not 0 -> problem, and furthermore, the bits of AL
indicate ports that couldn't accept the request, since
such port already is doing a file. The bits of AL are
defined in the same manner as BH, above.
┌─────────────────────────────┐
│ Print request using INT 1ah │
└─────────────────────────────┘
∙ AH = 0e4h
∙ AL = 1 (don't notify me when finished)
= 2 (do notify me when finished)
∙ ES:BX points to file ASCIIZ.
∙ CL - designates port:
1 = COM1
2 = COM2
3 = COM3
4 = COM4
5 = LPT1
6 = LPT2
7 = LPT3
8 = LPT4
On Return, AH=0 -> Okay
===============================================================================
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▌ REVISION LOG ▐
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
Version 1.01
------------
-- A bug existed whereby data was being despooled incorrectly. This has
been fixed in this version. Specifically, if timer-interrupt despooling
was taking place, then on certain rare occasions (whenever the number
of bytes left to print in the buffer was exactly 1), a byte of 0h would
be despooled, rather than the correct byte.
-- In DSPCTL1 in my INT8 hook, I now do an INT 1ah (with AH = 6eh). If
you are doing your own INT 8 hooks, you may want to try hooking this
INT 1ah instead. I will have already called the previous int 8, so you
don't have to worry about doing an EOI. You should put a re-entrancy
bypass into your routine, however.
------------------------------------
Version 1.02
------------
-- A minor bug existed in the computation of the amount of time to remain
inside of an int8 print request. This has been fixed.
-- I no longer require that the user turn on and turn off the irq's
insofar as COM ports are concerned. I do it myself at the
appropriate time.